<template>
	<view>
		<image src="/static/xgbj.png" class="qjimg" mode=""></image>
		<view class="title">
			<image @click="fanhui" src="/static/zfh.png" :style="'margin-top:'+top+'px;'" mode=""></image>
			<view class="toptit" :style="'margin-top:'+top+'px;'">
				抄表详情
			</view>
			<view class="" style="opacity: 0;">12</view>
		</view>

		<view class="boxtop">
			<view class="" style="width: 50rpx;height: 50rpx;">

			</view>
			<view class="box_title" style="margin-top: 0rpx;">
				业主信息
			</view>
			<view class="box_2">
				<view class="box_2text">
					业主姓名： <text>{{info.personName}}</text>
				</view>
				<view class="box_2text">
					联系电话：<text>{{info.mobile}} </text>
				</view>
				<view class="box_2text">
					房产信息： <text>{{info.address}}</text>
				</view>
			</view>
			<view class="" style="width: 50rpx;height: 20rpx;">
				<!-- {{chaobiao.addtime}} -->
			</view>
		</view>

		<view class="box">
			<view class="box1">
				<view class="box1text">
					抄表时间：{{chaobiao.addtime}}
				</view>
				<view :class="cid==0?'box1text1':'box1text2'">
					{{cid==0?'当月待抄':'当月已抄'}}
				</view>
			</view>
			<view class="box2">
				<view class="box2-1" style="margin-left: 30rpx;">
					<view class="box2-1text">
						{{chaobiao.cdatas.title}}
					</view>
					<view class="box2-1-1">
						<view class="box2-1-1box">
							单 &nbsp;&nbsp; &nbsp;&nbsp; 价：
						</view>
						<view class="box2-1-1box1_text1">
							￥{{chaobiao.cdatas.money}}
						</view>
					</view>
					<view class="box2-1-1">
						<view class="box2-1-1box">
							上次读数：
						</view>
						<view class="box2-1-1box1_text1">
							{{prev}}
						</view>
					</view>
					<view class="box2-1-1">
						<view class="box2-1-1box">
							本次用量：
						</view>
						<view class="box2-1-1box1_text1">
							{{chaobiao.enum}}
						</view>
					</view>
					<view class="box2-1-1">
						<view class="box2-1-1box">
							价 &nbsp;&nbsp; &nbsp;&nbsp; 格：
						</view>
						<view class="box2-1-1box1_text1">
							{{chaobiao.money}}
						</view>
					</view>
				</view>
				<view class="xian"></view>
				<view class="box3" v-if="cid==0">
					<view class="box3-1">
						本次读数：
					</view>
					<view class="box3-2">
						<input type="text" placeholder="0.0" v-if="cid==0" @blur="dushu" v-model="nownum">
						{{cid!=0?cid:''}}
					</view>
				</view>
			</view>
		</view>
		<view class="box">
			<view class="box1">
				<view class="box1text">
					抄表时间：2022-03-16 15:00-16:00
				</view>
				<view class="box1text1" style="color: black;">
					当月已抄
				</view>
			</view>
			<view class="box2">
				<view class="box2-1" style="margin-left: 30rpx;">
					<view class="box2-1text">
						井水费
					</view>
					<view class="box2-1-1">
						<view class="box2-1-1box">
							单 &nbsp;&nbsp; &nbsp;&nbsp; 价：
						</view>
						<view class="box2-1-1box1_text1">
							￥2.05
						</view>
					</view>
					<view class="box2-1-1">
						<view class="box2-1-1box">
							上次读数：
						</view>
						<view class="box2-1-1box1_text1">
							221.50
						</view>
					</view>
					<view class="box2-1-1">
						<view class="box2-1-1box">
							本次读数：
						</view>
						<view class="box2-1-1box1_text1">
							230.20
						</view>
					</view>
					<view class="box2-1-1">
						<view class="box2-1-1box">
							本次用量：
						</view>
						<view class="box2-1-1box1_text1">
							9.00
						</view>
					</view>
					<view class="box2-1-1">
						<view class="box2-1-1box">
							价 &nbsp;&nbsp; &nbsp;&nbsp; 格：
						</view>
						<view class="box2-1-1box1_text1">
							￥18.45
						</view>
					</view>
				</view>
				<view class="xian"></view>
				<view class="box3">
					<view class="box3-1">

					</view>
					<view class="box3-3" v-if="cid==0" @click="shengcheng">
						生成账单
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				top: 0,
				xungestate: 1,
				info: '',
				chaobiao: '',
				prev: '',
				roomId: '',
				tmpid: '',
				nownum: '',
				cid: ''
			}
		},
		onLoad(e) {
			this.roomId = e.roomId
			this.tmpid = e.tmpid
			this.cid = e.cid
			this.enum = e.enum
			let menuButtonInfo = uni.getMenuButtonBoundingClientRect()
			// this.CustomBar = menuButtonInfo.bottom * 1 + 10
			this.top = menuButtonInfo.top * 1 + 10
			this.getinfo()
		},
		methods: {
			dushu() {
				this.$post('wuyecenter/jisuan', {
					tmpid: this.tmpid,
					enum: this.prev,
					nownum: this.nownum
				}, res => {
					this.chaobiao.enum = this.nownum
					this.chaobiao.money = res.data.money
				})
			},
			shengcheng() {
				this.$post('wuyecenter/createchaobiao', {
					tmpid: this.tmpid,
					enum: this.prev,
					money: this.chaobiao.money,
					roomId: this.roomId,
					nownum: this.nownum
				}, res => {
					this.fanhui()
				})
			},
			getinfo() {
				this.$post('wuyecenter/chaobiaoinfo', {
					roomId: this.roomId,
					tmpid: this.tmpid,
					cid: this.cid
				}, res => {
					this.info = res.data.room
					this.prev = res.data.prev
					this.chaobiao = res.data.chaobiao
				})
			},
			fanhui() {
				uni.navigateBack({
					delta: 1
				})
			}
		}
	}
</script>

<style lang="scss">
	page {
		background-color: rgb(252, 252, 252);
	}

	.qjimg {
		width: 750rpx;
		height: 603rpx;
		position: absolute;
		top: 0;
		z-index: -1;
	}

	.toptit {
		font-size: 36rpx;
		font-family: Source Han Sans CN;
		font-weight: 500;
		color: #FFFFFF;
		line-height: 20rpx;
	}

	.title {
		display: flex;
		justify-content: space-between;
		align-items: center;

		>image {
			width: 12rpx;
			height: 24rpx;
			margin-left: 30rpx;
		}
	}

	.top {
		display: flex;
		margin-left: 46rpx;
		margin-top: 50rpx;

		>image {
			width: 97rpx;
			height: 97rpx;
		}
	}

	.top1 {
		margin-left: 16rpx;
		display: flex;
		flex-direction: column;
		justify-content: space-between;
	}

	.top1text {
		font-size: 30rpx;
		font-family: Source Han Sans CN;
		font-weight: 500;
		color: #FFFFFF;
		line-height: 50rpx;
	}

	.top1text1 {
		font-size: 22rpx;
		font-family: Source Han Sans CN;
		font-weight: 400;
		color: #FFFFFF;
		line-height: 50rpx;
	}

	.boxtop {
		background-image: linear-gradient(to top, #ecf3ff, #ecf3ff, #ffffff);
		width: 685rpx;
		margin: 60rpx auto;
		margin-bottom: 0;
		border-top-left-radius: 20rpx;
		border-top-right-radius: 20rpx;
	}

	.box_1 {
		display: flex;
		align-items: center;
		padding: 20rpx;

		>image {
			width: 94rpx;
			height: 94rpx;
		}
	}

	.box_1-1 {
		margin-left: 10rpx;
	}

	.box_1-1text {
		font-size: 30rpx;
		font-family: Source Han Sans CN;
		font-weight: 500;
		color: #333333;
		// line-height: 20rpx;
	}

	.box_1-1text1 {
		font-size: 24rpx;
		font-family: Source Han Sans CN;
		font-weight: 400;
		color: #999999;
		// line-height: 20rpx;
	}

	.box_title {
		margin-top: 50rpx;
		border-left: 8rpx solid #4ab6f9;
		width: 160rpx;
		text-align: center;
		font-size: 30rpx;
		font-family: Source Han Sans CN;
		font-weight: 500;
		color: #333333;
		// line-height: 20rpx;
	}

	.box_2 {
		width: 91%;
		margin: 30rpx auto;
	}

	.box_2text {
		font-size: 24rpx;
		font-family: Source Han Sans CN;
		font-weight: 400;
		color: #999999;
		// line-height: 20rpx;
		margin: 30rpx 0;

		>text {
			color: #333333;
		}
	}

	.texta {
		width: 91%;
		height: 170rpx;
		margin: 0 auto;
		background-color: #f6f6f6;
	}

	.box_3 {
		width: 91%;
		margin: 50rpx auto;
		display: flex;
		justify-content: space-between;

		>image {
			width: 200rpx;
			height: 200rpx;
		}
	}

	.button {
		width: 498rpx;
		height: 70rpx;
		margin: 0 auto;
		margin-top: 100rpx;
		color: #FFFFFF;
		text-align: center;
		background-color: #2e79f9;
		border-radius: 35rpx;
		line-height: 70rpx;
	}

	.box_2text1 {
		display: flex;
		justify-content: space-between;
		font-size: 28rpx;
		font-family: Source Han Sans CN;
		font-weight: 400;
		color: #909399;
		margin: 30rpx 0;

		>text {
			font-size: 28rpx;
			font-family: Source Han Sans CN;
			font-weight: 400;
			color: #DB203A;
		}
	}

	.text2 {
		font-size: 20rpx;
		font-family: Source Han Sans CN;
		font-weight: 400;
		color: #333333;
	}

	.topimg {
		position: absolute;
		right: 9%;
		width: 52rpx;
		height: 52rpx;
	}

	.box {
		margin-bottom: 20rpx;
	}

	.box1 {
		width: 685rpx;
		height: 63rpx;
		margin: 0 auto;
		background-image: linear-gradient(to right, #fcf3e3, #fae0d0, #ffffff);
		display: flex;
		justify-content: space-between;
		align-items: center;
	}

	.box1text {
		margin-left: 30rpx;
		font-size: 20rpx;
		font-family: Source Han Sans CN;
		font-weight: 400;
		color: #333333;
		line-height: 20rpx;
	}

	.box1text1 {
		margin-right: 30rpx;
		font-size: 24rpx;
		font-family: Source Han Sans CN;
		font-weight: 400;
		color: #DB203A;
		line-height: 20rpx;
	}

	.box1text2 {
		margin-right: 30rpx;
		font-size: 24rpx;
		font-family: Source Han Sans CN;
		font-weight: 400;
		color: #000000;
		line-height: 20rpx;
	}

	.box2 {
		width: 685rpx;
		margin: 0 auto;
		background-color: white;
		border-bottom-left-radius: 15rpx;
		border-bottom-right-radius: 15rpx;
	}

	.box2-1 {
		padding: 30rpx 0;
	}

	.box2-1text {
		font-size: 28rpx;
		font-family: Source Han Sans CN;
		font-weight: 500;
		color: #000000;
		line-height: 20rpx;
		display: flex;
		align-items: center;
	}

	.box2-1text1 {
		margin-left: 16rpx;
		width: 92rpx;
		height: 36rpx;
		background-color: #e6eeff;
		border-radius: 5%;
		font-size: 18rpx;
		font-family: Source Han Sans CN;
		font-weight: 500;
		color: #2D75FC;
		text-align: center;
		line-height: 36rpx;
	}

	.box2-1-1 {
		margin-top: 14rpx;
		display: flex;
		align-items: center;
	}

	.box2-1-1box {
		font-size: 24rpx;
		font-family: Source Han Sans CN;
		font-weight: 400;
		color: #999999;
		line-height: 20rpx;

		>view {
			font-size: 24rpx;
			font-family: Source Han Sans CN;
			font-weight: 400;
			color: #999999;
			line-height: 36rpx;
		}

	}

	.box2-1-1box1 {
		margin-left: 180rpx;
	}

	.box2-1-1box1_text {
		font-size: 30rpx;
		font-family: Source Han Sans CN;
		font-weight: 400;
		color: #333333;
		line-height: 36rpx;
		display: flex;
		align-items: center;

		>image {
			margin-left: 18rpx;
			width: 32rpx;
			height: 32rpx;
		}
	}

	.box2-1-1box1_text1 {
		font-size: 24rpx;
		font-family: Source Han Sans CN;
		font-weight: 400;
		color: #333333;
		line-height: 36rpx;
	}

	.xian {
		width: 636rpx;
		height: 2rpx;
		margin: 0 auto;
		margin-top: 25rpx;
		background-color: #e3e3e3;
	}

	.box3 {
		width: 636rpx;
		margin: 0 auto;
		padding: 30rpx 0;
		display: flex;
		justify-content: space-between;
		align-items: center;
	}

	.box3-1 {
		font-size: 24rpx;
		font-family: Source Han Sans CN;
		font-weight: 400;
		color: #333333;
	}

	.box3-2 {
		padding: 0 10rpx;
		width: 172rpx;
		height: 47rpx;
		border: 2rpx solid #e3ab21;
		border-radius: 10rpx;
		font-size: 24rpx;
		font-family: Source Han Sans CN;
		font-weight: 400;
		text-align: right;
		color: #999999;
		line-height: 47rpx;
	}

	.box3-3 {
		width: 120rpx;
		height: 45rpx;
		background-color: #de6d00;
		border-radius: 10rpx;
		font-size: 20rpx;
		font-family: Source Han Sans CN;
		font-weight: 500;
		text-align: center;
		color: #FFFFFF;
		line-height: 45rpx;
	}
</style>
